package com.lt.bookkeeping.coustomView;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.lt.bookkeeping.R;
import com.lt.bookkeeping.Utils.Utils;

/**
 * @author LiuTong
 */
public class FlowTag extends LinearLayout {
    private LayoutInflater mLayoutInflater;
    private View view;
    private TextView tagTv,btnCancel;
    public FlowTag(Context context) {
        this(context,null);
    }

    public FlowTag(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs,0);
    }

    public FlowTag(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mLayoutInflater = LayoutInflater.from(context);
        view = mLayoutInflater.inflate(R.layout.flow_tag,null);
        addView(view);
        initView();
    }

    private void initView() {
        tagTv = findViewById(R.id.tag_tv);
        btnCancel = findViewById(R.id.tag_cancel);
        setBtnCancel(getResources().getString(R.string.icon_cancel));
    }

    public void setText(String str){
        tagTv.setText(str);
    }

    public View getTagBtnCancel(){
        return btnCancel;
    }

    public void setBtnCancel(String imageStr){
        Utils.setTextView(btnCancel,imageStr,5);
    }
    public int tagCancelId(){
        return btnCancel.getId();
    }

    public int tagTextId(){
        return tagTv.getId();
    }


}
